﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.Messaging;
using CommonLib;
namespace Project1.View
{
    /// <summary>
    /// UserControlSelectionCard.xaml 的交互逻辑
    /// </summary>
    public partial class UserControlSelectionCard : UserControl
    {
        public UserControlSelectionCard()
        {
            InitializeComponent();
            //Messenger.Default.Register<string>(this, "CallBack", OnResponse);
            Messenger.Default.Send<Action>(new Action(SetControlHidden),"HiddenCard");
            Messenger.Default.Send<Action>(new Action(SetControlVisible), "OpenCard");
        }

        public void SetControlVisible()
        {
            tabControl.Visibility = Visibility.Visible;
        }
        public void SetControlHidden()
        {
            tabControl.Visibility = Visibility.Hidden;
        }
        //private void OnResponse(string msg)
        //{
        //    if(msg == "dispSelectionCard")
        //    {
        //        tabControl.Visibility = Visibility.Visible;
        //    }
        //}
        private void Button_Detect_Point(object sender, RoutedEventArgs e)
        {

           // tabControl.Visibility = Visibility.Hidden;
            //UserControlPoint.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_POINT, "MeasureType");
        }

        private void Button_Detect_PeakPoint(object sender, RoutedEventArgs e)
        {
            //tabControl.Visibility = Visibility.Hidden;
            //  UserControlPeakPoint.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_POINT_PEAK, "MeasureType");
        }

        private void Button_Detect_Line(object sender, RoutedEventArgs e)
        {
            //tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Detect_LMid(object sender, RoutedEventArgs e)
        {
            //tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }


        private void Button_Detect_LC(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LC_Cross, "MeasureType");
        }

        private void Button_Detect_CC(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_CC_Cross, "MeasureType");
        }

        private void Button_Detect_CCenter(object sender, RoutedEventArgs e)
        {
           // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_C_Center, "MeasureType");
        }

        private void Button_Detect_ArcCenter(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_P_Mid, "MeasureType");
        }
        private void Button_Measure_Angle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LL_ANGLE, "MeasureType");
        }
        private void Button_Measure_RArc(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }

        private void Button_Detect_AverLL(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LL_Mid, "MeasureType");
        }

        private void Button_Measure_TruePorosity(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Measure_Concentricity(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Measure_Straightness(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Measure_Parallelism(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Measure_StraightAngle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Measure_Roundness(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Detect_AverPL(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_PL_Mid, "MeasureType");
        }
        private void Button_Detect_AverPP(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_PP_Mid, "MeasureType");
        }
        private void Button_Detect_VerticalL(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_PL_VERTICAL, "MeasureType");
        }
        private void Button_Detect_Parallel(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_PL_Parallel, "MeasureType");
        }
        private void Button_Detect_FitLine(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_P_FitLine, "MeasureType");
        }

        private void Button_Detect_LineCombine(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LL_Concate, "MeasureType");
        }
        private void Button_Detect_PCTangent(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }

        private void Button_Detect_InnerCircle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LL_InnerC, "MeasureType");
        }

        private void Button_Detect_SupCircle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_C_SUP, "MeasureType");
        }

        private void Button_Detect_InCircle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_CC_Mid, "MeasureType");
        }

        private void Button_Detect_FitCircle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_C_Fit, "MeasureType");
        }

        private void Button_Detect_CombineArc(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_Arc_Concat, "MeasureType");
        }


        private void Button_Detect_ArcPeakPoint(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }

        private void Button_Detect_PeakLine(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Detect_PeakCircle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Detect_Arc(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Detect_PeakArc(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LINE, "MeasureType");
        }
        private void Button_Measure_PPDist(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_PP_DIST, "MeasureType");
        }
        private void Button_Measure_PLDist(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_PL_DIST, "MeasureType");
        }
        private void Button_Measure_LLDist(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LL_Dist, "MeasureType");
        }
        private void Button_Measure_PCDist(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_PC_DIST, "MeasureType");
        }
        private void Button_Measure_LCDist(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_LC_DIST, "MeasureType");
        }
        private void Button_Measure_CCDist(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_CC_DIST, "MeasureType");
        }
        private void Button_Measure_CRadius(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_C_RADIUS, "MeasureType");
        }

        private void Button_Measure_ArcAngle(object sender, RoutedEventArgs e)
        {
            // tabControl.Visibility = Visibility.Hidden;
            //  UserControlLine.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_ARC_ANGLE, "MeasureType");
        }

        private void Button_Detect_Circle(object sender, RoutedEventArgs e)
        {
           // tabControl.Visibility = Visibility.Hidden;
            //UserControlCircle.Visibility = Visibility.Visible;
            Messenger.Default.Send<int>(ConstValue.MEASURE_CIRCLE, "MeasureType");
        }

        private void Button_Detect_LLCross(object sender, RoutedEventArgs e)
        {
            Messenger.Default.Send<int>(ConstValue.MEASURE_LL_Cross, "MeasureType");
        }
    }
}
